package allwe.lock;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.ReentrantLock;

public class AqsTest extends AbstractQueuedSynchronizer {

    private static ReentrantLock reentrantLock = new ReentrantLock();

    public static void main(String[] args) {
        reentrantLock.lock();
//        reentrantLock.tryLock();
//        reentrantLock.tryLock(5000, TimeUnit.MILLISECONDS);
//        reentrantLock.lockInterruptibly();

        try {
            System.out.println("加锁打印");
        } finally {
            reentrantLock.unlock();
        }
    }
}
